package com.zte.claa.inficombo.csa.app.service.rptparse.ext.gnss;

// HCMonitor服务器解析的数据
public class GNEHResultDataV2 {
	public static final String TIME_FORMAT = "yyyy/MM/dd HH:mm:ss";
	
	// 基本属性.
	private String stationid; 		// 测站ID
	private String parsetimescope; 	// st-et, st和et均为 yyyy/MM/dd HH:mm:ss格式；
	private double x;    //X坐标；
	private double y;    //Y坐标；
	private double z;    //Z坐标；	
	
	// 构建器.
	public GNEHResultDataV2(){
		
	}
		
	public String getStationid() {
		return stationid;
	}

	public void setStationid(String stationid) {
		this.stationid = stationid;
	}

	public String getParsetimescope() {
		return parsetimescope;
	}

	public void setParsetimescope(String parsetimescope) {
		this.parsetimescope = parsetimescope;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	public double getZ() {
		return z;
	}

	public void setZ(double z) {
		this.z = z;
	}

	/**
	 * 解析上报的当地时间.
	 * 
	 * @return
	 * @throws Exception
	 */
	/*
	public Date parseLocalTime() throws Exception {
		SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
		return sdf.parse(this.localTime);		
	}
	*/
	
	/**
	 * 解析GNSS服务器的响应结果（逗号分隔的Ascii字符串）
	 * 
	 * @param rsp
	 * @return
	 */
	public static GNEHResultDataV2 parseRspData(String rsp) {
		if(rsp == null || rsp.trim().equals("")){
			return null;
		}
		String[] attrValues = rsp.split(",");
		if(attrValues.length < 7){
			return null;
		}		
		GNEHResultDataV2 gnssRsp = new GNEHResultDataV2();
		// gnssRsp.setEnginename(attrValues[1].trim());
		gnssRsp.setStationid(attrValues[2].trim());
		gnssRsp.setParsetimescope(attrValues[3].trim());
		gnssRsp.setX(Double.parseDouble(attrValues[4].trim()));
		gnssRsp.setY(Double.parseDouble(attrValues[5].trim()));
		gnssRsp.setZ(Double.parseDouble(attrValues[6].trim()));
		return gnssRsp;
	}
}
